<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        canvas {
            border: 1px solid red;
        }
    </style>
</head>

<body>

    <!-- 

        canvas以js作为载体，绘制图形，常用于动态数据加载的图形化页面，300*150
     -->
    <canvas id="c1" width="500" height="500">您的浏览器不支持该标签</canvas>
    <script>
        var c = document.getElementById("c1");//获取画板
        var ctx = c.getContext("2d");//获取画笔工具(笔触)
        ctx.beginPath();//开启新的路径
        ctx.moveTo(0, 0);
        ctx.lineTo(250, 250);
        ctx.stroke();

        ctx.beginPath();
        ctx.lineTo(110, 20);
        ctx.lineTo(200, 20);
        ctx.lineTo(200, 100);
        ctx.lineTo(110, 100);
        ctx.lineTo(110, 20);
        ctx.stroke();


        ctx.fillRect(200, 200, 300, 100);
        ctx.beginPath();
        ctx.arc(100, 75, 50, 0, 2 * Math.PI);
        ctx.stroke();
    </script>
</body>

</html>